<?php

use Illuminate\Support\Facades\Route;
use App\Admin\Controllers\LoginController;
use App\Admin\Controllers\AdminUserController;
use App\Admin\Controllers\UserController;
use App\Admin\Controllers\MenusController;
use App\Admin\Controllers\RolesController;
use App\Admin\Controllers\ApiMenusController;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::post('/login', [LoginController::class, 'login']);
Route::post('/logout', [LoginController::class, 'logout']);

register_route('/adminUser', AdminUserController::class, function ($controller) {
    Route::get('/info',[$controller, 'info']);
    Route::post('/list',[$controller, 'list']);
    Route::post('/addOrEdit',[$controller, 'addOrEdit']);
    Route::post('/del',[$controller, 'del']);
});

register_route('/menus', MenusController::class, function ($controller) {
    Route::get('/menu',[$controller, 'getMenu']);
    Route::post('/addOrEditMenu',[$controller, 'addOrEditMenu']);
    Route::post('/delMenu',[$controller, 'delMenu']);
});

register_route('/apiMenus', ApiMenusController::class, function ($controller) {
    Route::post('/list',[$controller, 'list']);
    Route::post('/getAllList',[$controller, 'getAllList']);
    Route::post('/addOrEditMenu',[$controller, 'addOrEditMenu']);
    Route::post('/delMenu',[$controller, 'delMenu']);
});

register_route('/user', UserController::class, function ($controller) {
    Route::get('/list',[$controller, 'list']);
});

register_route('/roles', RolesController::class, function ($controller) {
    Route::post('/list',[$controller, 'list']);
    Route::get('/selectList',[$controller, 'selectList']);
    Route::post('/addOrEditRole',[$controller, 'addOrEditRole']);
    Route::post('/del',[$controller, 'del']);
});


